#include "DeltaGlider.h"
#include "at1000.msh.resource.h"
#pragma warning(disable : 4996)


double DeltaGlider::rand(void) //used to return random times for damage simulation
{
	double tTime = 0;
	while (tTime < 100)
	{
		tTime = oapiRand();
		tTime = abs(tTime);
	}
	return tTime *= 10000;	
}

//need a function that sets both of these with one income
//bool damaged_parts[5]; //damaged_parts[0] not used
//bool damage_partsRND[5]; //damage_partsRND[0] not used

void DeltaGlider::set_damage(double numb, int which)
{
	//possible choices are
	// 00, 01, 10, 11
	float compare = 5;
	if (numb > compare)  //means that the part is damaged
	{
		if (numb == 11) //damaged and rand is on
		{
			damaged_parts[which] = 1;
			damage_partsRND[which] = 1;
		}
			
		else //damaged and rand off
		{
			damaged_parts[which] = 1;
			damage_partsRND[which] = 0;
		}
	}
	else //means not currently damaged
	{
		if (numb == 1) //not damaged and rand is on
		{
			damaged_parts[which] = 0;
			damage_partsRND[which] = 1;
		}
		else  //not damaged and rand off
		{
			damaged_parts[which] = 0;
			damage_partsRND[which] = 0;
		}
	}
}
